package com.maysham.coder.server.dao;

import com.maysham.coder.server.model.Code;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class CodeDao extends BaseDao<Code> {
    @Resource
    private MongoTemplate template;

    public Page<Code> page(String groupId, Pageable pageable) {
        return pageQuery(Criteria.where("group.id").is(groupId), pageable);
    }
}
